import service from '@/utils/request'

// 获取当前登录用户的菜单信息
export function getUserMenuApi() {
  return service({
    url: '/user/menu',
    method: 'get'
  })
}

// 获取用户列表
export function getUserMenuListApi(data) {
  return service({
    url: '/user/list',
    method: 'post',
    data
  })
}
// 删除用户
export function deleteUserApi(id) {
  return service({
    url: `/user/delete/${id}`,
    method: 'delete'
  })
}
// 新增用户
export function addUserApi(data) {
  return service({
    url: '/user/add',
    method: 'post',
    data
  })
}
// 编辑用户
export function editUserApi(data) {
  return service({
    url: '/user/edit',
    method: 'post',
    data
  })
}
// 获取用户绑定的菜单id 只含有最后一级 方便树回显
export function getUserBindMenuInfoApi(id) {
  return service({
    url: `/user/bindMenuInfo/${id}`,
    method: 'get'
  })
}
// 用户绑定菜单
export function userBindMenuApi(data) {
  return service({
    url: '/user/bindMenu',
    method: 'post',
    data
  })
}
